<template>
  <div>
    <el-divider content-position="left">用户登录</el-divider>
    用户名：
    <el-input v-model="registerForm.username" placeholder="请输入用户名"></el-input>
    密码：
    <el-input v-model="registerForm.password" placeholder="请输入密码"></el-input>
    <el-button type="primary" @click="success">注册</el-button>
    <el-button type="primary" @click="userlogin">登录</el-button>
  </div>
</template>

<script>
import { register, login } from '../api/module/categories'
export default {
  //import引入的组件
  components: {},
  //子组件引用父组件:data=data 方法@search=search使用this.emit('search', '参数');
  props: [],
  data () {
    return {
      registerForm: {
        username: '',
        password: ''
      }

    };
  },
  methods: {
    /**注册 */
    success () {
      register(this.registerForm).then((result) => {
        console.log(result)
      })
    },
    /**登录 */
    userlogin () {
      login(this.registerForm).then((result) => {
        alert("登录成功")
        console.log(result);
      })
    }
  },
  mounted () { },
};
</script>

<style></style>